﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:converters="clr-namespace:Vibstudio.NetConfigurator.UI.Converters">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Shared.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <converters:ResultConverter x:Key="ResultConverter" />

    <Style x:Key="{x:Type ListView}"
           TargetType="ListView">
        <Setter Property="SnapsToDevicePixels"
                Value="true" />
        <Setter Property="OverridesDefaultStyle"
                Value="true" />
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility"
                Value="Auto" />
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility"
                Value="Auto" />
        <Setter Property="ScrollViewer.CanContentScroll"
                Value="true" />
        <Setter Property="VerticalContentAlignment"
                Value="Center" />
        <Setter Property="BitmapEffect"
                Value="{Binding Path=Result, Converter={StaticResource ResultConverter}, ConverterParameter=BitmapEffect}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ListView">
                    <Border Name="Border"
                            BorderThickness="1"
                            BorderBrush="#999999"
                            Background="#DFDFDF">
                        <ScrollViewer Style="{DynamicResource {x:Static GridView.GridViewScrollViewerStyleKey}}">
                            <ItemsPresenter />
                        </ScrollViewer>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsGrouping"
                                 Value="true">
                            <Setter Property="ScrollViewer.CanContentScroll"
                                    Value="false" />
                        </Trigger>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter TargetName="Border"
                                    Property="Background"
                                    Value="#BBBBBB" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ListViewItemContainerStyle"
           TargetType="{x:Type ListViewItem}">
        <Setter Property="Background"
                Value="#ffffff" />
        <Setter Property="HorizontalContentAlignment"
                Value="Left" />
        <Setter Property="VerticalContentAlignment"
                Value="Center" />
        <Setter Property="Foreground"
                Value="Black" />
        <Setter Property="Margin"
                Value="0,0,0,0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListViewItem}">
                    <Border x:Name="Bd"
                            Background="{TemplateBinding Background}"
                            SnapsToDevicePixels="true"
                            BorderThickness="0,0,0,1"
                            BorderBrush="#6FBDE8">
                        <GridViewRowPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected"
                                 Value="true">
                            <Setter TargetName="Bd"
                                    Property="BorderBrush"
                                    Value="#FF143c65" />
                            <Setter Property="Background"
                                    TargetName="Bd">
                                <Setter.Value>
                                    <LinearGradientBrush EndPoint="0,1"
                                                         StartPoint="0,0">
                                        <LinearGradientBrush.GradientStops>
                                            <GradientStopCollection>
                                                <GradientStop Color="#FF75aac7"
                                                              Offset="0" />
                                                <GradientStop Color="#FF143c65"
                                                              Offset="1" />
                                            </GradientStopCollection>
                                        </LinearGradientBrush.GradientStops>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsMouseOver"
                                 Value="True">
                            <Setter TargetName="Bd"
                                    Property="Background"
                                    Value="#e0eff8" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected"
                                           Value="true" />
                                <Condition Property="Selector.IsSelectionActive"
                                           Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter Property="Background"
                                    TargetName="Bd">
                                <Setter.Value>
                                    <LinearGradientBrush EndPoint="0,1"
                                                         StartPoint="0,0">
                                        <LinearGradientBrush.GradientStops>
                                            <GradientStopCollection>
                                                <GradientStop Color="#FF75aac7"
                                                              Offset="0" />
                                                <GradientStop Color="#FF143c65"
                                                              Offset="1" />
                                            </GradientStopCollection>
                                        </LinearGradientBrush.GradientStops>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="BorderBrush"
                                    TargetName="Bd"
                                    Value="#FF143c65" />
                            <Setter Property="Foreground"
                                    Value="White" />
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>